package com.common.dao.impl;

import java.io.Serializable;
import java.util.List;

import org.mybatis.spring.support.SqlSessionDaoSupport;

import com.common.dao.BaseDao;

/**
 * 描述：通用功能
 * @author：<a href="mailto:beier.zheng@yeepay.com">郑贝尔</a>
 * @since：Nov 19, 2012 6:10:26 PM
 * @version:1.0
 */
public abstract class BaseDaoImpl<T,PK extends Serializable> extends SqlSessionDaoSupport implements BaseDao<T,PK>{
	public   int  save(String key,T t){
		return getSqlSession().insert(key,t);
	}
	
	public int deleteById(String key,PK id){ 
		return getSqlSession().delete(key,id);
	}
	
	public int deleteByObject(String key,Object object){
		return getSqlSession().delete(key,object);
	}
	
	public  T get(String key,T t){
		return (T)getSqlSession().selectOne(key,t);
	}
	
	public  List<T> getList(String key){
		return getSqlSession().selectList(key);
	}
	
 
	public  List<T> getList(String key,T t){
		return getSqlSession().selectList(key,t);
	}

}

